package com.wtwd.campus.send;

import com.wtwd.campus.common.Constants;
import com.wtwd.campus.entity.Command;
import com.wtwd.campus.entity.DeviceAlarm;
import com.wtwd.campus.entity.MqGeneralSet;
import com.wtwd.campus.entity.MqMessage;

public class DelAlarmSender implements Sender {
    @Override
    public Command dealMessage(MqMessage mqMessage) {
        MqGeneralSet mqGeneralSet = (MqGeneralSet) mqMessage.getObject();
        String sequence = (String) mqGeneralSet.getValue();
        //指令拼接
        String commandContent= "*".concat(Constants.MANUFACTURER_NAME).concat(",").concat(mqGeneralSet.getImei()).concat(",").concat(Constants.DELETE_CLOCK).concat(",")
                .concat(mqGeneralSet.getCommandNumber()).concat(",").concat(sequence).concat("#");
        Command command=new Command();
        command.setImei(mqGeneralSet.getImei());
        command.setCommandNumber(mqGeneralSet.getCommandNumber());
        command.setStatus(Constants.COMMAND_NEED_SAVE);
        command.setContent(commandContent);
        command.setCmd(Constants.ALARM_CLOCK);
        command.setSequence(Integer.valueOf(sequence));
        return command;
    }
}
